from vizdoom import *
import random
import time
import site
game = DoomGame()
base_dir = site.getsitepackages()[1]
game.load_config( base_dir+r'\vizdoom\scenarios\basic.cfg' )

game.init()

shoot = [0, 0, 1]
left = [1, 0, 0]
right = [0, 1, 0]
actions = [shoot, left, right]

no_of_episodes = 10
for i in range(no_of_episodes):
    # for each episode start the game
    game.new_episode()
    # loop until the episode is over
    while not game.is_episode_finished():
        # get the game state
        state = game.get_state()
        img = state.screen_buffer
        # get the game variables
        misc = state.game_variables
        # perform some action randomly and receive reward
        reward = game.make_action(random.choice(actions))
        print(reward)
        # we will set some time before starting the next episode
        time.sleep(2)